package com.lxh.lxhcrm.model.pojos;

import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * 回款计划表
 * @author jw
 */
@Entity
@DynamicUpdate
public class Returnmon {
    private int returnId;
    private Date returnDate;
    private Integer isReturn;
    private String remark;
    private Integer returnMoney;
    private Integer inv = 1;
    private Date returnMakeDate = new Date();


    /** 合同对象 */
    private Contract contract;
    /** 回款期次 */
    private ReturnTimes returnTimes;
    /** 负责人 */
    private Emp principal;


    @ManyToOne
    @JoinColumn(name = "contract_id")
    public Contract getContract() {
        return contract;
    }

    public void setContract(Contract contract) {
        this.contract = contract;
    }
    @ManyToOne
    @JoinColumn(name = "return_times_id")
    public ReturnTimes getReturnTimes() {
        return returnTimes;
    }

    public void setReturnTimes(ReturnTimes returnTimes) {
        this.returnTimes = returnTimes;
    }

    @ManyToOne
    @JoinColumn(name = "emp_id")
    public Emp getPrincipal() {
        return principal;
    }

    public void setPrincipal(Emp principal) {
        this.principal = principal;
    }

    @Id
    @Column(name = "return_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getReturnId() {
        return returnId;
    }

    public void setReturnId(int returnId) {
        this.returnId = returnId;
    }

    @Basic
    @Column(name = "return_money")
    public Integer getReturnMoney() {
        return returnMoney;
    }

    public void setReturnMoney(Integer returnMoney) {
        this.returnMoney = returnMoney;
    }

    @Basic
    @Column(name = "return_date", nullable = true)
    public Date getReturnDate() {
        return returnDate;
    }

    public void setReturnDate(Date returnDate) {
        this.returnDate = returnDate;
    }

    @Basic
    @Column(name = "is_return", nullable = true)
    public Integer getIsReturn() {
        return isReturn;
    }

    public void setIsReturn(Integer isReturn) {
        this.isReturn = isReturn;
    }

    @Basic
    @Column(name = "remark", nullable = true, length = 200)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Basic
    @Column(name = "inv")
    public Integer getInv() {
        return inv;
    }

    public void setInv(Integer inv) {
        this.inv = inv;
    }

    @Basic
    @Column(name = "return_make_date")
    public Date getReturnMakeDate() {
        return returnMakeDate;
    }

    public void setReturnMakeDate(Date returnMakeDate) {
        this.returnMakeDate = returnMakeDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Returnmon returnmon = (Returnmon) o;
        return returnId == returnmon.returnId &&
                Objects.equals(returnDate, returnmon.returnDate) &&
                Objects.equals(isReturn, returnmon.isReturn) &&
                Objects.equals(remark, returnmon.remark) &&
                Objects.equals(returnMoney, returnmon.returnMoney) &&
                Objects.equals(inv, returnmon.inv) &&
                Objects.equals(returnMakeDate, returnmon.returnMakeDate) &&
                Objects.equals(contract, returnmon.contract) &&
                Objects.equals(returnTimes, returnmon.returnTimes) &&
                Objects.equals(principal, returnmon.principal);
    }

    @Override
    public int hashCode() {
        return Objects.hash(returnId, returnDate, isReturn, remark, returnMoney, inv, returnMakeDate, contract, returnTimes, principal);
    }

    @Override
    public String toString() {
        return "Returnmon{" +
                "returnId=" + returnId +
                ", returnDate=" + returnDate +
                ", isReturn=" + isReturn +
                ", remark='" + remark + '\'' +
                ", returnMoney=" + returnMoney +
                ", inv=" + inv +
                ", return_make_date=" + returnMakeDate +
                ", contract=" + contract +
                ", returnTimes=" + returnTimes +
                ", principal=" + principal +
                '}';
    }
}
